package cn.itcast.controller;

import cn.itcast.entity.Result;
import cn.itcast.mobile.MobileOrderService;
import cn.itcast.utils.JwtUtils;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Demo class
 *
 * @author gyc
 * @date 2021 /10/17
 */
@RestController
@RequestMapping("/order")
public class OrderInfoController {

    @Reference
    private MobileOrderService orderService;

    /**
     * Submit order result.
     *
     * @param map the map
     * @return the result
     */
    @PostMapping("/submit")
    public Result submitOrder(@RequestBody Map map){
//        Member user = ThreadLocalUtils.getUser();
        return orderService.submitOrder(map);
    }
    @GetMapping("/{id}")
    public Result findOrderById(@PathVariable("id")String id){
        return orderService.findOrderById(id);
    }
}
